package com.atguigu.tingshu.user.api;

import com.atguigu.tingshu.common.result.Result;
import com.atguigu.tingshu.model.user.VipServiceConfig;
import com.atguigu.tingshu.user.service.VipServiceConfigService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "VIP服务配置管理接口")
@RestController
@RequestMapping("api/user/vipServiceConfig")
@SuppressWarnings({"unchecked", "rawtypes"})
public class VipServiceConfigApiController {

	@Autowired
	private VipServiceConfigService vipServiceConfigService;

	// 查询所有的vip购买方案
	// http://127.0.0.1:8500/api/user/vipServiceConfig/findAll
	@Operation(summary = "查询所有vip购买方案")
	@GetMapping("findAll")
	public Result findAll() {
		return Result.ok(vipServiceConfigService.list());
	}
	// api/user/vipServiceConfig/findVipById/{id}
	// 远程调用 根据id 查询vip的购买方案
	@GetMapping("findVipById/{id}")
	public Result<VipServiceConfig> findVipById(@PathVariable("id") Long id) {
		VipServiceConfig vipconfig = vipServiceConfigService.getById(id);
		return Result.ok(vipconfig);
	}


}

